package com.kkshop.gwt.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface UserUtilsService extends RemoteService {

    boolean userExists(String username);
    
    String getCurrentUser();
    
    public static class UserUtilsServiceHelper {
        
        private static UserUtilsServiceHelper instance;
        
        public static UserUtilsServiceHelper getInstance() {
            if(instance == null) {
                instance = new UserUtilsServiceHelper();
            }
            return instance;
        }
        
        public UserUtilsServiceAsync getService() {
            UserUtilsServiceAsync userUtils = (UserUtilsServiceAsync) GWT.create(UserUtilsService.class);
            ServiceDefTarget endPoint = (ServiceDefTarget) userUtils;
            endPoint.setServiceEntryPoint("/services/com/kkshop/gwt/service/UserUtilsService.rpc");
            return userUtils;
        }
    }
}
